{php include wl_template('common/header');}
{php include wl_template('common/footerbar');}
{if $config['base']['meiqia']>0}
<script type='text/javascript'>

	(function(m, ei, q, i, a, j, s) {
		m[a] = m[a] || function() {
			(m[a].a = m[a].a || []).push(arguments)
		};
		j = ei.createElement(q),
				s = ei.getElementsByTagName(q)[0];
		j.async = true;
		j.charset = 'UTF-8';
		j.src = i + '?v=' + new Date().getUTCDate();
		s.parentNode.insertBefore(j, s);
	})(window, document, 'script', '//static.meiqia.com/dist/meiqia.js', '_MEIQIA');
	_MEIQIA('entId', {$config['base']['meiqia']});
</script>
{/if}
<style>
	.canTuan:active{
		color: #fff;
	}
	.link-rule{
		height:100%;
		width:100%;
		background-color:
		rgba(128,128,128,0.5);
		position:fixed;top:0px;
		left:0px;
		z-index:10000;
	}
	.link-rule>div{
		text-align:center;
		position:absolute;
		top:0;
		bottom:0;
		left:8px;
		right:8px;
		margin-top:auto;
		margin-bottom:auto;
		height:85%;
		background-color:white;
		border-radius:8px;
	}
	.link-rule>div>div:first-child{
		font-weight:bold;
		background-color:#ececec;
		font-size:20px;
		line-height:40px;
		border-radius:8px 8px 0 0;
		height:40px;
	}
	.link-rule>div div:nth-child(2){
		text-align:left;
		position:absolute;
		top:48px;
		bottom:45px;
		left:19px;
		right:19px;
		overflow:scroll;
	}
	.link-rule>div div:last-child{
		position:absolute;
		left:0px;
		right:0px;
		width:150px;
		height:30px;
		bottom:5px;
		/*background-color:var(--main-color);*/
		color:white;
		font-size:18px;
		margin-left:auto;
		margin-right:auto;
		line-height:30px;
		border-radius:5px;
	}
	#pricedown {
		display: block;
		width: 40px;
		height: 40px;
		background-color: hsl(194, 57%, 64%);
		color: hsl(0, 0%, 100%);
		line-height: 15px;
		text-align: center;
		border-radius: 20px;
		padding-top: 5px;
		font-size: 12px;
		right: 20px;
		bottom: -20px;
		position: absolute;
	}
	#numPerson,#numPrices,#numGroup, #tuanPre {display:none;}
	#jieTiGroup {background-color:white;padding:10px;}
	#jieTiGroup>div {margin-bottom:10px;}
	#jieTiGroup>div>div:first-child{width:100%;height:20px;}
	.preTuan{height:20px;width:50%;line-height:20px;box-sizing:border-box;float:left;}
	.numTuan {height:20px;width:100%;line-height:20px;box-sizing:border-box;text-align:right;}
	.process{margin-top:20px;margin-bottom:20px;position:relative;width:90%;margin-left:5%;height:20px;border-radius:10px;background-color:white;border:1px solid hsl(354, 91%, 73%)}
	.progressBar {background-image:linear-gradient(90deg,#6fbfd8,hsl(354, 91%, 73%));height:100%;border-radius:10px;left:0px;top:0px;}
	.progressStep {border:1px solid white;height:14px;width:4px;border-radius:7px;position:absolute;top:2px;background-color:white;}
	.progressStep>div:first-child {position: absolute;top: -20px;width: 40px;text-align: center;left: -20px;line-height: 20px;height: 20px;}
	.progressStep>div:last-child {position: absolute;top: 14px;width: 40px;text-align: center;left: -20px;line-height: 20px;height: 20px;}
	.payToGroup {height: 30px;line-height: 30px;text-align: center;width: 80%;background-color: rgb(248, 123, 136);border-radius: 20px;color: white;margin-left: 10%;}
	#over {text-align:right}
	.link-rule p {text-indent:2em;}
	#returnBack {
		width: 40px;
		height: 40px;
		border-radius: 20px;
		background: linear-gradient(90deg,transparent 1px, hsla(0, 0%, 50%, 0.7) 0);
		position: absolute;
		left: 20px;
		top: 20px;
		z-index: 3;
		color: white;
		text-align: center;
		line-height: 16px;
		padding-top: 4px;
		font-weight: bold;
		font-size: 12px;
	}
	#returnBack::before {
		content: '';
		position: absolute;
		left: -3px;
		top: 16px;
		height: 8px;
		width: 8px;
		background: linear-gradient(45deg,hsla(0, 0%, 50%,0.7) 50%, transparent 0);
		transform: rotate(45deg);
		-webkit-transform:rotate(45deg);
	}
	.zhuiping{
		font-size: 12px;
		background: #aaa;
		padding: 3px 6px;
		border-radius: 4px;
		color: #fff;
	}
	#div_sections{
		margin-bottom: 30px;
	}
	/*:root{ --main-color: {$_W['system_color']}; }/!*#e4393c   #6fbfd8*!/*/
	/*.stepGuild .step_item_on .step_num,.stepGuild .step_tit i{*/
		/*background-color: var(--main-color);*/
	/*}*/
	.canTuan{
		color: #fff;
		width: 90%;
		margin: 10px auto;
		height: 40px;
		line-height: 40px;
		display: block;
		/*background-color: var(--main-color);*/
		text-align: center;
		border-radius: 5px;
	}
	section>div{
		background-color: #fff;
		padding: 0 10px;
	}
	.salesVolume{
		color:#3d4145;
	}
	.guige{
		margin-bottom: 10px;
		padding: 5px 10px;
		border-top: 1px solid #eee;
	}
	.guige text,.salesVolume text{
		color:#9d9d9d;
		margin-right:15px;
	}
	.jinDuTiao{
		padding:5px 10px;
	}
	.peopleNum{
		float:right;
	}
	/*.peopleNum text,.maincolor{*/
		/*color:var(--main-color);*/
	/*}*/
	.timeRemaining{
		text-align:right;
	}
	.JDT{
		position: relative;
		height: 10px;
		margin: 5px 0;
	}
	.JDTbackgd,.JDTjindu{
		background:#ddd;
		width:100%;
		border-radius:10px;
		height:10px;
		position:absolute;
	}
	.JDTjindu{
		z-index:5;
		/*background:var(--main-color);*/
		width:100%;
	}
	.pinTuanJia{
		padding:10px;
	}

	.pinTuanJia>div:first-child{
		float: left;
		/*background: var(--main-color);*/
		font-size: 18px;
		color: #fff;
		width: 60px;
		height: 30px;
		line-height: 30px;
		border-top-left-radius: 5px;
		border-bottom-left-radius: 5px;
		text-align: center;
	}
	.pinTuanJia>div:last-child{
		display:inline-block;
	}
	.pinTuanJia ul{
		border: 1px solid #ddd;
		border-bottom:none;
	}
	.pinTuanJia li{
		height: 30px;
		line-height: 30px;
		padding: 0 10px;
		border-bottom: 1px solid #ddd;
	}

	.pinTuanJia li.active,.salesVolume b.active{
		color:{$_W['system_color']};
	}
	.pinTuanJia li text{
		/*margin-right:10px;*/
		min-width: 80px;
		display: inline-block;
	}
	.pinTuanJia li img,.salesVolume b img{
		position: relative;
		right: -8px;
		width:70px;
		margin-right: 10px;
	}
	.timeRemaining>span{
		padding:2px 4px;
		border-radius: 5px;
		/*border:1px solid var(--main-color);*/
		margin:0 2px;
		font-weight: 800;
	}
	.aboutProduct{
		width: 100%;
		padding-bottom: 1rem;
		display: flex!important;
		flex-wrap: wrap;
		justify-content: center;
		margin-bottom: 30px;
	}
	.aboutProduct li{
		width:90px!important;
	}
	.aboutProduct li img{
		height:90px!important;
	}
	.aboutProduct li:first-child{
		margin-left: 3.4%!important;
	}
	.dingjin{
		color: #9d9d9d;
	}
	.dingjin span{
		color: #27272f;
	}
	.dingjin p{
		padding: 2px 0;
	}
	.dingjin img{
		width: 13px;
		margin-right: 5px;
	}
	.stepGuild .step_flow{
		padding:0;
	}
	.openImg{
		display: none;
		width: 100%;
		position: fixed;
		top: 0;
		z-index: 3000;
		height: 100%;
		background: rgba(0,0,0,0.75);
		left: 0;
	}

</style>
<span id="tuanPre">666,777</span>
<span id="numPerson">10,20,50,100</span>
<span id="numPrices">0.03,0.02,0.01,0.005</span>
<span id="numGroup">100,40</span>
<span id="goodsid">{$goods['id']}</span>
<span id="isshow">{$goods['isshow']}</span>
<div class="page-group">
	<div class="page page-current" id="page-goods-detail">
		<div class="content">
			<div class="dt_detail" >
				<div class="sliderImage">
					<div class="images" id="sliderImg" style="visibility: visible;">
						<ul>
							{loop $advs $adv}
							<li><img src="{php echo tomedia($adv['thumb']);}" style='width:100%;'></li>
							{/loop}
						</ul>
					</div>
					<div class="images_num" id="sliderNum">

						{php $slideNum = 1;}
						{loop $advs $adv}
						<span{if $slideNum == 1} class="curr"{/if}></span>
						{php $slideNum++;}
						{/loop}
					</div>
				</div>
				<section class="detail_main" style="position:relative">
					<div class="productInfo" >
						<h2 style="padding-top: 10px;">{$goods['gname']}</h2>
					</div>
					<div id="jieTiGroup">

					</div>
					<div class="salesVolume" style="display: block;">
						<span style="float: left;"><text>原 价</text><b>￥{$goods['oprice']}</b></span>
					</div>
					<!--<div style="padding-left:10px;color:#888;background-color:white;font-size:0.8em;">商品确认收货后可获得10086积分</div>-->

					<script>
						$(function() {
							new Swipe($('#sliderImg')[0], {
								speed:500,
								auto:3000,
								callback: function(){
									var lis = $("#sliderNum").children();
									lis.removeClass("curr").eq(this.index).addClass("curr");
								}
							});
						});
					</script>
					<div class="pinTuanJia" data-num="{$nownum}">
						<div   style="background-color: {$_W['system_color']}">拼团价</div>
						<div>
							<ul>
								{loop $param_level $item}
								<li  data-id="{$item['groupnum']}"><text>￥{$item['groupprice']}</text>{$item['groupnum']}人以上</li>
								{/loop}

							</ul>
						</div>
					</div>
					<div class="dingjin">
						<p><image src="../../../../../../addons/lexiangpingou/app/resource/images/group/ctdj.png"/>参团定金 <span>{$goods['preprice']}元</span></p>
						<!--<p><image src="../../../../../../addons/lexiangpingou/app/resource/images/group/tzwk.png"/>团长外快 <span>{$nownum}</span></p>-->
						<p><image src="../../../../../../addons/lexiangpingou/app/resource/images/group/ctsj.png"/>成团时间 <span>{$goods['endtime']}小时</span></p>
					</div>
					<!--<div class="guige"><text>规 格</text>{$goods['mprice']}</div>-->
					<div class="jinDuTiao" {if empty($nowgroup)}style="display: none"{/if} data-servertime="{php echo time()}" data-endtime="{php echo $nowgroup['endtime']}" data-starttime="{php echo $nowgroup['starttime']}">
					<div>
						<span>团长 {$first_member['nickname']}</span>
						<span class="peopleNum"><text style="color: {$_W['system_color']}">{$nownum}</text>人参团</span>
					</div>
					<div class="JDT">
						<div class="JDTbackgd"></div>
						<div class="JDTjindu"   style="background-color: {$_W['system_color']}"></div>
					</div>
					<div class="timeRemaining">剩余时间 <span style="border:1px solid {$_W['system_color']}"></span>天<span style="border:1px solid {$_W['system_color']}"></span>时<span style="border:1px solid {$_W['system_color']}"></span>分<span style="border:1px solid {$_W['system_color']}"></span>秒</div>
			</div>
			<div style="background: #fff;padding: 10px">
				{if $checkbuy==1}
				<a href="{$maurl}" class="canTuan" style="background-color: {$_W['system_color']}">{if empty($nowgroup)}一键开团{else}立即参团{/if}</a>
				{else}
				<span class="canTuan openFXImg" style="background-color: {$_W['system_color']}">立即参团</span>
				{/if}

			</div>
			</section>


			<script>

				//倒计时
				var endtime=$('.jinDuTiao').attr('data-endtime');
				var EndTime = new Date(endtime);
				setInterval(function(){
					var NowTime = new Date();
					var t =endtime+'000' - Date.parse(NowTime);
					var d=0;
					var h=0;
					var m=0;
					var s=0;
//						console.log(endtime);
//						console.log(Date.parse(NowTime));
					if(t>=0){
						d=Math.floor(t/1000/60/60/24);
						h=Math.floor(t/1000/60/60%24);
						m=Math.floor(t/1000/60%60);
						s=Math.floor(t/1000%60);
						$('.timeRemaining>span:first-child').html(d);
						$('.timeRemaining>span:nth-child(2)').html(h);
						$('.timeRemaining>span:nth-child(3)').html(m);
						$('.timeRemaining>span:nth-child(4)').html(s);
					}else{
						$('.timeRemaining>span').html(0);
					}
				},500);
				//进度条百分比

				var endSUM=parseInt($('.pinTuanJia li:last-child').attr('data-id'));
				var nowSUM=parseInt($('.peopleNum text').html());
				if(nowSUM<=endSUM) {
					$('.JDTjindu').css('width', (nowSUM/endSUM) * 100 + '%');
				}

				//团列表
				var nownum=parseInt($('.pinTuanJia').attr('data-num'));
				var lis=$('.pinTuanJia li');
				var len=lis.length-1;
				for(var i=0;i<lis.length;i++){
					//console.log(parseInt($(lis[len]).attr('data-id')));
					//console.log($(lis[i]).attr('data-id'));
					if(nownum<parseInt($(lis[i]).attr('data-id'))){
						$('.salesVolume b').addClass('active').append('<image src="../../../../../../addons/lexiangpingou/app/resource/images/group/hand2.png"/>');
						i=lis.length+1;
					}else if(nownum==parseInt($(lis[i]).attr('data-id'))){
						$(lis[i]).addClass('active').append('<image src="../../../../../../addons/lexiangpingou/app/resource/images/group/hand2.png"/>');
						i=lis.length+1;
					}else if(nownum>=parseInt($(lis[i]).attr('data-id'))){
						i++;
						if(nownum<parseInt($(lis[i]).attr('data-id'))) {
							$(lis[i-1]).addClass('active').append('<image src="../../../../../../addons/lexiangpingou/app/resource/images/group/hand2.png"/>');
							i=lis.length+1;
						}
						i--;
					}
					if(nownum>=parseInt($(lis[len]).attr('data-id'))){
						i=lis.length-1;
						$(lis[i]).addClass('active').append('<image src="../../../../../../addons/lexiangpingou/app/resource/images/group/hand2.png"/>');
					}
				}
				function lookdetail(e){
					console.log(e);
					$('.link-rule').css("display","block");
				}
				function linkknow(){
					$('.link-rule').css("display", "none");
				}
				function exchange(numb) {
					$('#div_nav .boxx .sp').removeClass('on');
					$('.section_specification').removeClass('on');
					$('.section_detail').removeClass('on');
					$('a#shangpin'+numb).addClass('on');
					if(numb==0) {
						$('.section_specification').addClass('on');
					}else{
						$('.section_detail').addClass('on');
					}
				}
			</script>
			<section class="stepGuild">
				<div class="step_tit"><i style="background-color: {$_W['system_color']}"></i>拼团玩法<span><span id="lookdetail" onclick="lookdetail()">查看详情&gt;</span></span></div>
				<div class="step_flow">
					<div class="step_item step_item_on"><span class="step_num"  style="background-color: {$_W['system_color']}">1</span><span>选择<br>心仪商品</span></div>
					<div class="step_item"><span class="step_num">2</span><span class="steps">支付订金<br>或参团</span></div>
					<div class="step_item"><span class="step_num">3</span><span class="steps">邀请参团<br>阶梯降价</span></div>
					<div class="step_item"><span class="step_num">4</span><span class="steps">团购结束<br>补齐尾款</span></div>
				</div>
			</section>

		</div>

		<div class="section_body info_detail" style="border:none;{if $goods['isjudgment']==0}display:none;{/if}">
			<div class="orderregion" style="border-bottom: none; margin-bottom: 10px;">
				<h1 class="orderregion-title">
					<i class="icon1-detail status-detail-icon"></i>
					<label class="status-name">买家评价</label>
					<a href="{php echo app_url('goods/judgment_list',array('op' => 'judgment_list','gid' => $id))}"><span style="float: right; color: #9d9d9d; font-size: 14px; height: 40px;line-height: 40px;  display: inline-block; ">共{$total}条记录&gt;</span></a>
				</h1>

				{loop $list $item}

				<div style="clear: both; padding:10px; padding-bottom:0px; text-align: justify; border-bottom: 1px solid #f0f0f0;">
					<div style="width: 12%; float: left;">
						<img style="max-height: 100%; max-width: 100%;border-radius: 50%" src="{$item['avatar']}" >
					</div>
					<div style="width: 80%; float:left;margin-left: 10px; ">
						<span style="color: #666;">{$item['openname']}</span><br>
						<span style="color: #666; font-size: 12px; ">{$item['time']}</span>
					</div>
					<div style="clear: both;"></div>
					<?php
							$main_content = pdo_fetch("select * from ".tablename('tg_judgment_content')." where  judgment_id=:judgment_id order by update_time asc ",array('judgment_id'=>$item['judgment_id']));
					$allcontent = pdo_fetchall("select * from ".tablename('tg_judgment_content')." where  judgment_id=:judgment_id and content_id <> '". $main_content['content_id'] ."'  order by update_time asc ",array('judgment_id'=>$item['judgment_id']));
					?>
					<div style="font-size: 0.9em; padding-top: 3px; padding-bottom: 3px; color: #1a1a1a;">{$main_content['content']}</div>
					{loop $allcontent $content}
					{if $content['who']== 1}<label class="zhuiping">商家回复</label>{/if}
					{if $content['who']== 0}<label class="zhuiping">用户追评</label>{/if}<span style="margin-left:10px; color: #b8c0cc; font-size: 12px;"><?php echo date('Y-m-d H:i:s',$content['update_time']); ?></span>
					<div style="font-size: 12px; font-weight: 400;padding-bottom: 3px;">{$content['content']}</div>

					{/loop}

				</div>
				{/loop}

			</div>
		</div>

		<div class="section_body info_detail">
			<div>
				<div id="div_nav_fixed">
					<div id="div_nav" class="div_nav">
						<ul class="boxx" style="padding-left: 0px;">
							<li>
								<a onclick="exchange(1);" data-idx="1" class="sp on" id="shangpin1">图文详情</a>
							</li>
							<li>
								<a onclick="exchange(0);" data-idx="0" class="sp" id="shangpin0">商品属性</a>
							</li>
						</ul>
					</div>
				</div>
				<div id="div_sections" class="div_sections">
					<section class="section_specification">
						{loop $params $p}
						<dl>
							<div>
								<dd><label>{$p['title']}</label><label>{$p['value']}</label></dd>
							</div>
						</dl>
						{/loop}
					</section>
					<section class="section_detail on" data-role="widget" data-widget="img_prev_view">
						<div id="description" class="J_DetailSection tshop-psm tshop-psm-bdetaildes" style="margin:0px;padding:0px;">
							<div class="ke-post" id="productInfott" style="margin:10px 0px 0px;padding:0px;font-size:14px;font-family:tahoma, arial, 宋体, sans-serif;">
								<script>
									document.getElementById("productInfott").innerHTML=escapeHtml('{$goods['gdesc']}');
									function imgnone() {
										$('.openImg').css('display', 'none');
									}
									$(".openFXImg").on('click',function(){
										$(".openImg").css('display','block');
									})
								</script>
							</div>
						</div>
					</section>
				</div>
			</div>
		</div>

		<h2 class="guesslike">猜你喜欢 ❤</h2>
		<ul class="aboutProduct"></ul><!--aboutProduct-->
		<script type="text/javascript">guesslike("{php echo app_url('goods/ajaxlist/goods_rand')}");</script>
		<div>
			<div>
				<input type="hidden" name="times" id="times" value="{$times}" />
				<input type="hidden" name="one_limit" id="one_limit" value="{$goods['one_limit']}" />
				<input type="hidden" name="many_limit" id="many_limit" value="{$goods['many_limit']}" />


			</div>
			{if $goods['hasoption']==1||$goods['one_limit']>1}
			{php include wl_template('goods/goods_option');}
			{/if}
			<input type="hidden" id="buytype" value="" />
			<input type="hidden" id="buytype2" value="{$goods['groupnum']}" />
			<input type="hidden" id="optionid" name="optionid" value=""/>
		</div>

		<div class="link-rule" style="display:none;">
			<div>
				<div>拼团须知</div>
				<div>
					<div class="maincolor"  style="color: {$_W['system_color']}">什么是订金团？</div>
					<p>每个商品都可以设置阶梯价格及支付订金，当您通过拼团价购买时先支付订金，开团支付成功后再邀请朋友参团，参团人数达到组团规定人数时自动降价，团购结束后补齐尾款。尾款可以在线微信支付，如自提订单支持到店现金支付核销。</p>
					<!--<div class="maincolor">如何拼团成功？</div>-->
					<!--<p>拼团是基于好友的转发扩散，获取团购优惠。首先选择商品开团：选择拼团商品下单，团即刻开启，但团长完成支付，方能获取转发链接，并在团开启规定时间内邀请到相应人数的好友支付，此团方能成功。</p>-->
					<div class="maincolor"  style="color: {$_W['system_color']}">团长干嘛的？</div>
					<p>首先选择心仪的商品下单，并完成支付后即为团长。团长视为本次交易的发起人，且为第一位支付成功的成员。</p>
					<div class="maincolor"  style="color: {$_W['system_color']}">拼团成员是什么？</div>
					<p>通过分享出去的该团入口进入或者通过分享团入口进入并完成付款加入该团的团员，参团成员也可以将该团分享出去邀约更多的团员参团。</p>
					<!--<div class="maincolor">拼团失败是怎么回事？</div>-->
					<!--<p>从团长开团规定时间内未能找到相应开团人数的好友参团，则该团失败，系统会在48个小时内自动原路退款至你的支付账户中。</p>-->
				</div>
				<div id="link-know" onclick="linkknow()" style="background-color: {$_W['system_color']}">已了解</div>
			</div>
		</div>

		<script>
			var User = JSON.parse(localStorage.getItem("user"))|| {};
			var goodsid = document.getElementById("goodsid");
			var pricedown = document.getElementById("pricedown");
			var urlNotice = "{php echo app_url('goods/list/notice')}";
			var urlNoticeRemove = "{php echo app_url('goods/list/noticeremove')}";
			if (User[goodsid.innerHTML + "notice"]) {
				pricedown.style.backgroundColor = "#fcc602";
				pricedown.innerHTML = "等待<br/>通知";
			}
			document.getElementById("returnBack").onclick = function () {
				location.href = "{php echo app_url('goods_list')}";
			}
			function isshow() {
				var canBuy = Number(document.getElementById("isshow").textContent);;
				return canBuy == 1 ? true : false;
			}
			function postAjax(id, url, weight, str){
				var formData = new FormData();
				formData.append('id', id);
				if (weight !== undefined) {
					formData.append("weight", weight);
				}else {
					formData.append("type", 2);
				}
				if (str !==undefined){
					formData.append("str",str);
				}
				var xhr = new XMLHttpRequest();
				xhr.open('post', url, true);
				xhr.send(formData);
				console.log(id + ' ' + weight + ' ' + str);
				xhr.onreadystatechange = function() {
					if (xhr.readyState ==4) {
						if ((xhr.status >=200 && xhr.status<300) || xhr.status ==304){
							isPost = true;
							console.log(xhr.responseText);
							return !!xhr.responseText;
						}
						else {
							alert("由于网络或其他原因导致无法购买,请关闭浏览器重试");
							console.log("cuowu");
						}
					}
				}
			}
			var gohome = document.getElementById("gohome");
			gohome.onclick = function() {
				sessionStorage.removeItem("position");
			}

			function bb(b){
				var many_limit = $("#many_limit").val();
				var one_limit = $("#one_limit").val();
				var times = $("#times").val();
				many_limit = parseInt(many_limit);
				one_limit=parseInt(one_limit);
				times=parseInt(times);
				if (isshow()) {
					if(b==1){
						location.href = "{php echo app_url('order/orderconfirm')}" + "&id=" + {$goods['id']}+ "&groupnum=1";
						//location.href = "{php echo app_url('order/orderconfirm',array(‘id’=>$goods['id'],'groupnum'=>1));}";
					}else{

						if(many_limit>=1){
							if(times >= many_limit){
								$.toast('单人购买总数为：'+many_limit+',您已购买'+times);
								return false;
							}
						}
						var nn = "{$goods['groupnum']}";

						location.href = "{php echo app_url('order/orderconfirm')}" + "&groupnum=" + nn+ "&id=" + {$goods['id']};
					}
				}
				else {
					$.toast("库存不足");
				}
			}

			$("#num").blur(function(){
				var inputnum=$("#num").val();
				var marketprice = 0;
				var productprice = 0;
				var options = {php echo json_encode($options)};

				var ret = option_selected();
				var len = options.length;
				for (var i = 0; i < len; i++) {
					var o = options[i];
					var ids = ret.all.join("_");
					if (o.specs == ids) {
						optionid = o.id;
						stock = o.stock;
						marketprice = o.marketprice;
						productprice = o.productprice;
						break;
					}
				}
				if(marketprice==0){
					marketprice = "{php echo $goods['gprice']}";
				}
				var goodsPrice=marketprice;
				var totalPrice = goodsPrice*inputnum;
				totalPrice = totalPrice.toFixed(2);
				$("#option_gprice").html(totalPrice);
			});

			$("#up").bind('click',function(){
				var num = $('#num').val();
				num = parseInt(num)+1;
				$('#num').val(num);
				var marketprice = 0;
				var productprice = 0;
				var options = {php echo json_encode($options)};
				var ret = option_selected();
				var len = options.length;
				for (var i = 0; i < len; i++) {
					var o = options[i];
					var ids = ret.all.join("_");
					if ((o.specs == ids)&&o.specs) {
						optionid = o.id;
						stock = o.stock;
						marketprice = o.marketprice;
						productprice = o.productprice;
						break;
					}
				}
				if(marketprice==0){
					marketprice = "{php echo $goods['gprice']}";
				}
				if(productprice==0){
					productprice = "{php echo $goods['oprice']}";
				}
				var goodsPrice=marketprice;
				var inputnum=num;
				var totalPrice = goodsPrice*inputnum;
				totalPrice = totalPrice.toFixed(2);
				$("#option_gprice").html(totalPrice);
				$("#option_oprice").html((productprice*inputnum).toFixed(2));
			});

			$("#down").bind('click',function(){
				var num = $('#num').val();
				num = parseInt(num)-1;
				if(num<=0){
					num=1;
				}
				$('#num').val(num);
				var marketprice = 0;
				var productprice = 0;
				var options = {php echo json_encode($options)};
				var ret = option_selected();
				var len = options.length;
				for (var i = 0; i < len; i++) {
					var o = options[i];
					var ids = ret.all.join("_");
					if (o.specs == ids) {
						optionid = o.id;
						stock = o.stock;
						marketprice = o.marketprice;
						productprice = o.productprice;
						break;
					}
				}
				if(marketprice==0){
					marketprice = "{php echo $goods['gprice']}";
				}
				if(productprice==0){
					productprice = "{php echo $goods['oprice']}";
				}
				var goodsPrice=marketprice;
				var inputnum=num;
				var totalPrice = goodsPrice*inputnum;
				totalPrice = totalPrice.toFixed(2);
				$("#option_gprice").html(totalPrice);
				$("#option_oprice").html((productprice*inputnum).toFixed(2));
			});

			$("#num2").blur(function(){
				var inputnum=$("#num2").val();
				var gp=$("#gn").val();
				gp = inputnum * gp;
				$("#option_price").html(gp);
			});

			$("#up2").bind('click',function(){
				var num = $('#num2').val();
				num = parseInt(num)+1;
				$('#num2').val(num);
				var gp=$("#gn").val();
				gp = num * gp;
				$("#option_price").html(gp);
			});

			$("#down2").bind('click',function(){
				var num = $('#num2').val();
				num = parseInt(num)-1;
				if(num<=0){
					num=1;
				}
				$('#num2').val(num);
				var gp=$("#gn").val();
				gp = num * gp;
				$("#option_price").html(gp);
			});

			var options = {php echo json_encode($options)};
			var specs = {php echo json_encode($specs)};
			var hasoption = {php echo $goods['hasoption'] == '1' ? 'true' : 'false'};

			var selected = [];
			function option_selected() {
				var ret = {
					no: "",
					all: []
				};
				if (!hasoption) {
					return ret;
				}
				$(".optionid").each(function () {
					ret.all.push($(this).val());
					if ($(this).val() == '') {
						ret.no = $(this).attr("title");
						return false;
					}
				})
				return ret;
			}

			function closechoose(){
				$('.footer').show();
				$('.good_choose_layer').fadeOut(100);
				$('.good_choose').fadeOut(100);
			}



			function showStores(obj){
				if($(obj).attr('show')=='1'){
					$(obj).next('div').slideUp(100);
					$(obj).removeAttr('show').find('i').removeClass('fa-angle-down').addClass('fa-angle-up');
				}else{
					$(obj).next('div').slideDown(100);
					$(obj).attr('show','1').find('i').removeClass('fa-angle-up').addClass('fa-angle-down');
				}
			}
			function JTT() {
				var numPerson = document.getElementById("numPerson").textContent.split(",");
				var numPrices = document.getElementById("numPrices").textContent.split(",");
				var numGroup = document.getElementById("numGroup").textContent.split(",");
				var tuanPre = document.getElementById("tuanPre").textContent.split(",");
				var numTuan = tuanPre.length;
				var jtthtml = "";
				for (var j = 0; j < numTuan; j++) {
					jtthtml += '<div>'
					+ '<div>'
					+ '<div class="preTuan">团长:' + tuanPre[j] + '</div>'
					+ '<div class="numTuan">参团人数:' + numGroup[j] + '人</div>'
					+ '</div>'
					+ '<div class="process">'
					+ '<div class="progressBar"></div>'
					+ '</div>'
					+ '<div class="payToGroup">我要参团' + j + '</div>'
					+ '</div>';
				}
				var clickPayHandler;
				clickPayHandler = function (ev) {
					alert(ev.target.textContent);
					//alert("去支付");
				}
				var module = {};
				module.numPerson = numPerson;
				module.numPrices = numPrices;
				module.numTuan = numTuan;
				module.init = function() {
					var jieTiGroup = document.getElementById("jieTiGroup");
					jieTiGroup.insertAdjacentHTML('beforeend', jtthtml);
					for (var j = 0; j < this.numTuan; j++) {
						var progressBar = jieTiGroup.getElementsByClassName("progressBar")[j];
						progressBar.style.width = Math.round(Number(numGroup[j]) *100 / (Number(this.numPerson[this.numPerson.length - 1]) * 1.1)) + "%";
						var process = jieTiGroup.getElementsByClassName("process")[j];
						var payToGroup = jieTiGroup.getElementsByClassName("payToGroup")[j];
						payToGroup.onclick = clickPayHandler;
						for (var i = 0; i < this.numPerson.length; i++) {
							var div = document.createElement("div");
							div.className = "progressStep";
							div.style.right = Math.round(101 - Number(this.numPerson[i]) * 100 / (Number(this.numPerson[this.numPerson.length - 1]) * 1.1))  + "%";
							div.innerHTML = '<div>'+ this.numPerson[i] +'</div><div>'+ this.numPrices[i]+'</div>';
							process.appendChild(div);
						}
					}
				}

				return module;
			}



			}
			//	$('.huifu').on('click',function(e){
			//		console.log($(e));
			//		console.log($(this));
			//		$(e).next().next().slideToggle();
			//	})

		</script>
</div>
	</div>
<div class="openImg" onclick="imgnone()">
	<img src="{TG_URL_ARES}images/guide.png" alt=""/>
</div>
		{php include wl_template('common/footer');}
